package Myfunction

import (
	"strconv"
	"time"

	"github.com/gin-gonic/gin"
)

func Hello1(context *gin.Context) {
	//id := context.Param("id")
	//context.String(200, "获取id为%s", id)

	context.HTML(200, "demo02.html", nil)
}
func Hello2(context *gin.Context) {

	file, _ := context.FormFile("myfile")
	time_int := time.Now().Unix()
	time_str := strconv.FormatInt(time_int, 16)
	context.SaveUploadedFile(file, "D://"+time_str+"   "+strconv.FormatInt(time_int, 2)+file.Filename)
	context.String(200, "文件上传成功")
}
func Hello3(context *gin.Context) {

	form, _ := context.MultipartForm()
	files := form.File["myfile"]

	for _, file := range files {
		time_int := time.Now().Unix()
		time_str := strconv.FormatInt(time_int, 16)
		context.SaveUploadedFile(file, "D://"+time_str+"   "+strconv.FormatInt(time_int, 2)+file.Filename)
	}

	context.String(200, "文件上传成功")
}
